﻿using System;
using AppCommon;
using Controller;

public partial class LichKhoiHanh : System.Web.UI.Page
{
    public static string _idTour;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var idTour = Request.QueryString["UniqueId"];
            if (!string.IsNullOrEmpty(idTour))
            {
                _idTour = idTour;
                litNoidung.Text = _idTour;
                BindData();
                
            }            
        }
    }

    public void BindData()
    {
        var controller = new VYC06Controller();
        var id = GetIdLichkhoihanh();
        var model = controller.GetLichkhoihanh(id, _idTour, 0);
        litNoidung.Text = model.Count > 0 ? Server.HtmlDecode(model[0].NoiDung) : "<p class=\"text-danger\">Chưa có lịch khởi hành cho loại Tour này!</p>";
    }

    public int GetIdLichkhoihanh()
    {
        var controller = new VYC05Controller();
        var model = controller.GetByUniqueId(Common.ConvertToUnSign(Constants.LKH));
        return model[0].Id;
    }
}